/**
 * 
 */
package com.yidu.drug.service.impl;

import java.sql.Timestamp;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yidu.drug.dao.SpecificationModelMapper;
import com.yidu.drug.model.SpecificationModel;
import com.yidu.drug.service.SpecificationService;

/**
 * @author 王志伟
 * @date 2018年8月20日 下午8:47:25
 * @version 1.0
 */
@Service
public class SpecificationServiceImpl implements SpecificationService{

	//说明书的DAO
	@Resource
	private SpecificationModelMapper speDao;
	
	@Override
	public int deleteByPrimaryKey(String speId) {
		// TODO Auto-generated method stub
		return speDao.deleteByPrimaryKey(speId);
	}

	@Override
	public int insert(SpecificationModel record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertSelective(SpecificationModel record) {
		// TODO Auto-generated method stub
		//获取当前日期时间
		Timestamp ss = new Timestamp(new Date().getTime());
		record.setSpeDate(ss);
		return speDao.insertSelective(record);
	}

	@Override
	public SpecificationModel selectByPrimaryKey(String speId) {
		// TODO Auto-generated method stub
		return speDao.selectByPrimaryKey(speId);
	}

	@Override
	public int updateByPrimaryKeySelective(SpecificationModel record) {
		// TODO Auto-generated method stub
		//获取当前日期时间
		Timestamp ss = new Timestamp(new Date().getTime());
		record.setSpeDate(ss);
		return speDao.updateByPrimaryKeySelective(record);
	}

	@Override
	public int updateByPrimaryKey(SpecificationModel record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/**
	 * 根据 药品ID查询说明书
	 */
	@Override
	public SpecificationModel selectByDrugId(String drugId) {
		SpecificationModel spe=speDao.selectByDrugId(drugId);
		return spe;
	}

}
